<?php
/* [$WindsForce] (C)Hunzhiwange.COM Since 2012.03.17.
   查看新鲜事($$)*/

!defined('Q_PATH') && exit;

class Show_C_Controller extends InitController{

	public function index(){
		$nId=intval(Q::G('id','G'));
		if(empty($nId)){
			$this->page404();
		}

		$arrHomefresh=Model::F_('homefresh','@A','A.homefresh_id=? AND A.homefresh_status=1',$nId)
			->setColumns('A.homefresh_id,A.homefresh_title,A.user_id,A.create_dateline,A.homefresh_attribute,A.homefresh_commentnum,A.homefresh_goodnum,A.homefresh_type,A.homefresh_viewnum,A.homefresh_thumb,A.homefreshcategory_id')
			->join(Q::C('DB_PREFIX').'user AS B','B.user_name,B.user_sign','A.user_id=B.user_id')
			->join(Q::C('DB_PREFIX').'usercount AS C','C.usercount_extendcredit1','A.user_id=C.user_id')
			->join(Q::C('DB_PREFIX').'homefreshcontent AS E','E.homefresh_message','A.homefresh_id=E.homefresh_id')
			->joinLeft(Q::C('DB_PREFIX').'homefreshcategory AS D','D.homefreshcategory_name','A.homefreshcategory_id=D.homefreshcategory_id')
			->getOne();

		if(empty($arrHomefresh['homefresh_id'])){
			$this->page404();
		}

		// 更新点击量
		Model::M_('homefresh')->updateWhere(array('homefresh_viewnum'=>$arrHomefresh['homefresh_viewnum']+1),'homefresh_id=?',$nId);
		$arrHomefresh['homefresh_viewnum']++;

		Core_Extend::getSeo($this,array(
			'title'=>$arrHomefresh['homefresh_title'].'_装修学堂',
			'keywords'=>$arrHomefresh['homefresh_title'].'装修学堂'),true,false);
		
		$this->assign('arrHomefresh',$arrHomefresh);
		$this->display('xue+show');
	}

}
